    <%@ Page Title="Edit Commerce Product" MasterPageFile="../masterpages/umbracoPage.Master"
    ValidateRequest="false" Language="c#" CodeBehind="editProduct.aspx.cs" AutoEventWireup="True"
    Inherits="CommerceForUmbraco.adminSection.commerce.editProduct" %>

<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
  <script src="/umbraco/js/prototype.js" type="text/javascript"></script>

  <script language="javascript" type="text/javascript" src="/scripts/tiny_mce/tiny_mce.js"></script>
  <script type="text/javascript">
      tinyMCE.init({
          // General options
          mode: "textareas",
          theme: "advanced",
          plugins: "autolink,lists,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",

          // Theme options
          theme_advanced_toolbar_location : "top",
          theme_advanced_toolbar_align: "left",
          //theme_advanced_statusbar_location: "bottom",
          theme_advanced_resizing: true,
          theme_advanced_buttons1: "bold,italic,underline,strikethrough,|,bullist,numlist,|,formatselect,|,cut,copy,paste,pastetext,pasteword,|,link,unlink,|,code,spellchecker",
          theme_advanced_buttons2: "",
          theme_advanced_buttons3: ""

          // Skin options
//          skin: "o2k7",
//          skin_variant: "silver",

          // Example content CSS (should be your site CSS)
//          content_css: "css/example.css",

          // Drop lists for link/image/media/template dialogs
//          template_external_list_url: "js/template_list.js",
//          external_link_list_url: "js/link_list.js",
//          external_image_list_url: "js/image_list.js",
//          media_external_list_url: "js/media_list.js",

          // Replace values for the template plugin
//          template_replace_values: {
//              username: "Some User",
//              staffid: "991234"
//          }
      });
  </script>
  <style type="text/css">
      #ProductOptions
      {
          border:1px solid #CCCCCC;
          margin: 10px;
          padding:10px;
          background-color:#F3F3F9;
      }
  </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="body" runat="server">

    <cc1:TabView runat="server" ID="tabControl" Width="552px" Height="692px" />
    
      <cc1:Pane ID="Pane1" runat="server" Height="600px" Width="330px">
        <cc1:PropertyPanel runat="server" ID="pp_name">
              <asp:TextBox ID="ProductName" runat="server" Width="300" CssClass="guiInputText"></asp:TextBox>
        </cc1:PropertyPanel>
        <cc1:PropertyPanel runat="server" ID="pp_slug">
              <asp:TextBox ID="ProductSlug" runat="server" Width="300" CssClass="guiInputText"></asp:TextBox>
        </cc1:PropertyPanel> 
        <cc1:PropertyPanel runat="server" ID="pp_sku">
              <asp:TextBox ID="ProductSku" runat="server" Width="300" CssClass="guiInputText"></asp:TextBox>
        </cc1:PropertyPanel>     
        <cc1:PropertyPanel runat="server" ID="pp_our_price">
              <asp:TextBox ID="OurPrice" runat="server" Width="300" CssClass="guiInputText"></asp:TextBox>
        </cc1:PropertyPanel>
        <cc1:PropertyPanel runat="server" ID="pp_retail_price">
              <asp:TextBox ID="RetailPrice" runat="server" Width="300" CssClass="guiInputText"></asp:TextBox>
        </cc1:PropertyPanel>
        <cc1:PropertyPanel runat="server" ID="pp_manufacturer">
            <asp:DropDownList ID="Manufacturer" runat="server" Width="300" CssClass="guiInputText"></asp:DropDownList>
        </cc1:PropertyPanel>
        <cc1:PropertyPanel runat="server" ID="pp_status">
              <asp:DropDownList ID="Status" runat="server"  Width="300" CssClass="guiInputText"></asp:DropDownList>
        </cc1:PropertyPanel>
        <cc1:PropertyPanel runat="server" ID="pp_product_type">
              <asp:DropDownList ID="ProductType" runat="server" Width="300" CssClass="guiInputText"></asp:DropDownList>
        </cc1:PropertyPanel>
        <cc1:PropertyPanel runat="server" ID="pp_shipping_type">
              <asp:DropDownList ID="ShippingType" runat="server" Width="300" CssClass="guiInputText"></asp:DropDownList>
        </cc1:PropertyPanel>
        <cc1:PropertyPanel runat="server" ID="pp_ship_estimate">
              <asp:DropDownList ID="ShipEstimate" runat="server" Width="300" CssClass="guiInputText"></asp:DropDownList>
        </cc1:PropertyPanel>
        <cc1:PropertyPanel runat="server" ID="pp_tax_type">
              <asp:DropDownList ID="TaxTypeDDL" runat="server" Width="300" CssClass="guiInputText"></asp:DropDownList>
        </cc1:PropertyPanel>
        <cc1:PropertyPanel runat="server" ID="pp_stock_location">
              <asp:TextBox ID="StockLocation" runat="server" Width="300" CssClass="guiInputText"></asp:TextBox>
        </cc1:PropertyPanel>
        <cc1:PropertyPanel runat="server" ID="pp_weight">
              <asp:TextBox ID="Weight" runat="server" Width="300" CssClass="guiInputText"></asp:TextBox>
        </cc1:PropertyPanel>
        <cc1:PropertyPanel runat="server" ID="pp_width">
              <asp:TextBox ID="Width" runat="server" Width="300" CssClass="guiInputText"></asp:TextBox>
        </cc1:PropertyPanel>
        <cc1:PropertyPanel runat="server" ID="pp_height">
              <asp:TextBox ID="Height" runat="server" Width="300" CssClass="guiInputText"></asp:TextBox>
        </cc1:PropertyPanel>
        <cc1:PropertyPanel runat="server" ID="pp_length">
              <asp:TextBox ID="Length" runat="server" Width="300" CssClass="guiInputText"></asp:TextBox>
        </cc1:PropertyPanel>
        <cc1:PropertyPanel runat="server" ID="pp_dimension_unit">
              <asp:DropDownList ID="DimensionUnitChooser" runat="server" Width="300" CssClass="guiInputText">
                <asp:ListItem Text="Inches" Value="Inches" />
                <asp:ListItem Text="Feet" Value="Feet" />
                <asp:ListItem Text="Yards" Value="Yards" />
                <asp:ListItem Text="Millimeters" Value="Millimeters" />
                <asp:ListItem Text="Centimeters" Value="Centimeters" />
                <asp:ListItem Text="Meters" Value="Meters" />
              </asp:DropDownList>
        </cc1:PropertyPanel>
        <cc1:PropertyPanel runat="server" ID="pp_currency_code">
              <asp:DropDownList ID="CurrencyCodeDDL" runat="server" Width="300" CssClass="guiInputText"></asp:DropDownList>
        </cc1:PropertyPanel>
        <cc1:PropertyPanel runat="server" ID="pp_inventory">
              <asp:TextBox ID="Inventory" runat="server" Width="300" CssClass="guiInputText"></asp:TextBox>
        </cc1:PropertyPanel>
        <cc1:PropertyPanel runat="server" ID="pp_list_order">
              <asp:TextBox ID="ListOrder" runat="server" Width="300" CssClass="guiInputText"></asp:TextBox>
        </cc1:PropertyPanel>
        <cc1:PropertyPanel runat="server" ID="pp_admin_comments">
              <asp:TextBox ID="AdminComments" runat="server" Width="300" Height="100" CssClass="guiInputText"></asp:TextBox>
        </cc1:PropertyPanel>

       </cc1:Pane>
       
       <cc1:Pane ID="PaneDescription" runat="server">       
          <asp:PlaceHolder ID="blogpostControls" runat="server"></asp:PlaceHolder>       
          <cc1:PropertyPanel runat="server" ID="pp_short_description">
              <asp:TextBox ID="ShortDescription" runat="server" Width="500" Height="450" Wrap="true" TextMode="MultiLine" CssClass="guiInputText"></asp:TextBox>
            </cc1:PropertyPanel>
       </cc1:Pane>
       
      <cc1:Pane ID="Pane2" runat="server">
       <cc1:PropertyPanel ID="pp_categories" runat="server">
         <asp:DropDownList ID="categoryDDL" runat="server" Width="300" CssClass="guiInputText" />
         <asp:Button ID="categoryAddButton" runat="server" Text="Add" 
               onclick="categoryAddButton_Click" />         
       </cc1:PropertyPanel>
       <p>&nbsp;</p>
       <cc1:PropertyPanel ID="pp_category_list" runat="server">
        <asp:Repeater ID="categoryList" runat="server" 
               onitemcommand="categoryList_ItemCommand">
            <ItemTemplate>
            <asp:Label ID="CategoryNameDisplay" runat="server" CssClass="guiInputText" Width="300"><%#Eval("CategoryName") %></asp:Label>
            &nbsp;&nbsp;
            <asp:Button ID="categoryDeleteButton" runat="server" Text="Delete" CommandArgument='<%#Eval("CategoryID") %>' />
            <br />
            </ItemTemplate>
        </asp:Repeater>
       </cc1:PropertyPanel>
       </cc1:Pane>
       
      <cc1:Pane ID="Pane3" runat="server">
        <cc1:PropertyPanel ID="pp_images" runat="server">
            <asp:Panel ID="pnlMediaPicker" runat="server">
            </asp:Panel>
            <asp:Image ID="productImageView" runat="server" />
        </cc1:PropertyPanel>
        <cc1:PropertyPanel ID="pp_otherimages" runat="server">
            <asp:Panel ID="pnlOtherImagesMediaPicker" runat="server">
            </asp:Panel>
            <asp:Button ID="otherimagesAddButton"  runat="server" Text="Add" 
               onclick="otherimagesAddButton_Click" />         
       </cc1:PropertyPanel>
       <p>&nbsp;</p>
        <cc1:PropertyPanel ID="pp_otherimages_list" runat="server">
            <asp:Repeater ID="otherImagesList" runat="server" 
                   onitemcommand="otherImagesList_ItemCommand">
                <ItemTemplate>
                <div style="border: 1px solid #D9D7D7; padding: 10px; margin: 5px;">
                    Order: <asp:TextBox ID="otherImageOrder" runat="server" Width="25" Text='<%#Eval("listOrder") %>'></asp:TextBox>
                    Caption: <asp:TextBox ID="otherImageCaption" runat="server" Width="115" Text='<%#Eval("caption") %>'></asp:TextBox>
                    <asp:Button ID="otherImageButtonUpdate" runat="server" Text="Update" CommandArgument='<%#Eval("imageID") %>' CommandName="order" />
                    <asp:Button ID="otherImageButton" runat="server" Text="Delete" CommandArgument='<%#Eval("imageID") %>' CommandName="delete" />
                    &nbsp;&nbsp;
                    <asp:Label ID="OtherImagesFileDisplay" runat="server" CssClass="guiInputText" Width="150"><%# Eval("imageFile").ToString().Substring(Eval("imageFile").ToString().LastIndexOf('/')+1) %></asp:Label>
                    
                    <div style="margin: 10px 0 0 25px;">
                        <asp:Image ID="otherImageThumbnail" runat="server" ImageUrl='<%# String.Format("/umbraco/ImageGen.ashx?height=100&width=100&antialias=true&format=png&constrain=true&image={0}", Eval("imageFile")) %>' />
                    </div>               
                </div>
                </ItemTemplate>
            </asp:Repeater>
        </cc1:PropertyPanel>
      </cc1:Pane> 
      
      <%-- 
      <cc1:Pane ID="Pane4" runat="server">
        <cc1:PropertyPanel ID="pp_add_descriptor_list_order" runat="server">
        	<asp:TextBox ID="DescriptorListOrder" runat="server" CssClass="guiInputText" >1</asp:TextBox>
        </cc1:PropertyPanel>
        <cc1:PropertyPanel ID="pp_add_descriptor_title" runat="server">
			<asp:TextBox ID="DescriptorTitle" runat="server" CssClass="guiInputText" Width="300"></asp:TextBox>
			&nbsp;
			<asp:CheckBox ID="chkIsBulletedList" runat="server" Text="Is Bulleted List" CssClass="guiInputText" />
		</cc1:PropertyPanel>
		<cc1:PropertyPanel id="pp_add_descriptor_text" runat="server">
			<asp:TextBox ID="DescriptorText" runat="server" TextMode="MultiLine" CssClass="guiInputText" Width="300" Height="200"></asp:TextBox>
			<br />
			<asp:Button ID="SaveDescriptorButton" runat="server" Text="Add" onclick="SaveDescriptorButton_Click" />
		</cc1:PropertyPanel>
        <p>&nbsp;</p>
        <cc1:PropertyPanel ID="pp_descriptor_list" runat="server">
            <asp:Repeater ID="rptDescriptors" runat="server" 
                onitemcommand="rptDescriptors_ItemCommand">
				<ItemTemplate>
		            <p>&nbsp;</p>		
					<asp:Label id="DescriptorTitleDisplay" runat="server" CssClass="guiInputText" Width="300"><%#Eval("Title") %></asp:Label>
					<asp:CheckBox ID="chkIsBulletedList" runat="server" Checked='<%#(bool)Eval("isBulletedList") %>' Text="Is Bulleted List" CssClass="guiInputText"/>
					<br />
                    List Order:  <asp:TextBox ID="txtDescriptorListOrder" runat="server" Text='<%#Eval("listOrder")%>' Width="20px"></asp:TextBox>
                    <br />					
				    <asp:TextBox ID="txtDescriptor" runat="server" TextMode="MultiLine" CssClass="guiInputText" Width="300" Height="200" Text='<%#Eval("descriptor")%>'></asp:TextBox>
				    <br />
				    <asp:Button ID="DeleteDescriptorButton" runat="server" Text="Delete" CommandArgument='<%#Eval("descriptorID") %>' CommandName="delete" />
				</ItemTemplate>
			</asp:Repeater>
		</cc1:PropertyPanel>
      </cc1:Pane> 
      --%>
      
      <%-- 
      <cc1:Pane ID="Pane5" runat="server">
        <cc1:PropertyPanel ID="PropertyPanel2" runat="server">
          
        </cc1:PropertyPanel>
      </cc1:Pane> 
      --%>
      
      <cc1:Pane ID="Pane6" runat="server">
        <cc1:PropertyPanel ID="PropertyPanel3" runat="server">
        
          <div style="padding: 0 10px 10px 10px;">
            <h3>Currently Selected Products:</h3>
            <div style="padding: 15px 0 3px 0;">
                <asp:PlaceHolder ID="currentCrossSellsPH" runat="server"></asp:PlaceHolder>
                <div style="clear: both;"></div>
            </div>
          </div>
          
          <div style="clear: both;"></div>
          
          <hr />
        
          <asp:CheckBoxList ID="chkProducts" runat="server" CellPadding="5" CellSpacing="2" RepeatColumns="3" ></asp:CheckBoxList>
        </cc1:PropertyPanel>
      </cc1:Pane> 

      <cc1:Pane ID="Pane7" runat="server">
       <cc1:PropertyPanel ID="pp_productOptions" runat="server">
         <asp:DropDownList ID="DropDownListProductOptions" runat="server" Width="300" CssClass="guiInputText" />
         <asp:Button ID="ButtonAddProductOptions" runat="server" Text="Add" 
               onclick="optionsAddButton_Click" />         
       </cc1:PropertyPanel>
       <p>&nbsp;</p>
       <cc1:PropertyPanel ID="pp_options" runat="server">
        <asp:Repeater ID="RepeaterProductOption" runat="server" 
               onitemcommand="productOptionList_ItemCommand">
            <ItemTemplate>
            <div id="ProductOptions">

            <div>
                Option Name:
                <asp:Label ID="OptionNameDisplay" runat="server" CssClass="guiInputText" Width="300"><%#Eval("AttributeName")%></asp:Label>
            </div>
            <div>
                Option Description:
                <asp:Label ID="descriptionLabel" runat="server" CssClass="guiInputText" Width="300"><%# Eval("Description") %></asp:Label>
            </div>
            <div>
                Option List:
                <asp:Label ID="OptionListLabel" runat="server" CssClass="guiInputText" Width="300"><%# GetOptionList(Convert.ToString(Eval("TemplateID"))) %></asp:Label>
            </div>
            <div>
                Option Type:
                <asp:Label ID="Label1" runat="server" CssClass="guiInputText" Width="300"><%# GetOptionType(Convert.ToString(Eval("AttributeTypeID")))%></asp:Label>
            </div>
            <asp:Button ID="OptionDeleteButton" runat="server" Text="Delete" CommandArgument='<%#Eval("TemplateID") %>' />
            <br />
            </div>
            </ItemTemplate>
        </asp:Repeater>

       </cc1:PropertyPanel>
      </cc1:Pane> 

       
       
</asp:Content>

